define(function (require, exports, module) {
    exports.ready = function(){
        require.async('$', function(){
            var arr = location.pathname.split('/');
            var order_id = parseInt(arr[arr.length-1]);
            var store_id = parseInt(arr[arr.length-3]);
            //console.log(store_id, order_id);

            //获取订单金额
            $.ajax({
                url:'/restaurant/Trustworthyshop/paySelect',
                type:'post',
                data:{
                    store_id:store_id,
                    order_id:order_id
                },
                dataType:'json',
                success:function(data){
                    if(data.status === 'S'){

                    }
                }
            });

            //点击切换支付方式
            $('.select').click(function(){
               $(this).addClass('icon-xuanzhong').parents('.method').siblings().find('.select').removeClass('icon-xuanzhong');
            });

            //点击支付
            $('.payment').click(function(){
                var id = parseInt($('.icon-xuanzhong').parents('.method').attr('data-id'));
                console.log(id);

                $.ajax({
                    url:'',
                    type:'post',
                    data:{
                        store_id:store_id,
                        order_id:order_id
                    },
                    dataType:'json',
                    success:function(data){
                        if(data.status === 'S'){

                        }
                    }
                })
            });
        });
    }
});